﻿using System;
using System.IO;
using System.Web.UI;

public partial class MasterPage_Ajax : MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["p"] == null) return;
        var page = Request["p"];
        var virtualPath = string.Format("~/Ajax/UserControl/{0}.ascx", page);
        var pathUc = string.Format("~/Ajax/UserControl/{0}.ascx", page);
        var fileExsits = File.Exists(Server.MapPath(pathUc));
        if (!fileExsits) return;
        var uc = LoadControl(virtualPath);
        ContentPlaceHolderMain.Controls.Add(uc);
    }
}
